import 'package:flutter/material.dart';
import 'package:shopping_group/utils/object_util.dart';

import '../res/colors.dart';
import '../res/dimens.dart';
import '../utils/widget_utils.dart';

// 组合view
class CombinationView {
  static Widget showItmeView(IconData icon, String title,
      {double leftPadding: 16,
      double textleftPadding: 16,
      Color blackColor: Colors.white,
      bool isHideIcon: false,
      bool isHideConten: true,
      String content,
      FontWeight titleFontweight: FontWeight.w400}) {
    return Container(
      color: blackColor,
      padding: EdgeInsets.only(left: leftPadding, top: 8, bottom: 8),
      child: Row(
        children: <Widget>[
          isHideIcon
              ? Container()
              : Icon(
                  icon,
                  color: Colours.themeColor,
                  size: 32,
                ),
          Expanded(
              flex: 1,
              child: ObjectUtil.isEmptyString(title)
                  ? Container()
                  : Container(
                      padding: EdgeInsets.only(left: textleftPadding),
                      child: WidgetUtils.getTextColorView(
                          title, Colors.black, Dimens.FONT_SIZE_16,
                          fontweight: titleFontweight),
                    )),
          isHideConten
              ? Container()
              : Container(
                  padding: EdgeInsets.only(left: textleftPadding),
                  child: (ObjectUtil.isEmptyString(title)
                      ? Container()
                      : WidgetUtils.getTextColorView(
                          content, Colors.black, Dimens.FONT_SIZE_16)),
                ),
          Container(
            padding: const EdgeInsets.only(right: 16),
            child: Icon(
              Icons.keyboard_arrow_right,
              color: Colours.themeColor,
            ),
          ),
        ],
      ),
    );
  }
}
